package com.example.work12.recevier;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Handler;

import com.example.work12.service.MyService;

public class MyRecevier extends BroadcastReceiver {
    private Handler handler;

    public MyRecevier(Handler handler) {
        this.handler = handler;
    }

    @Override
    public void onReceive(Context context, Intent intent) {
        if(intent.getAction().equals("shang")){
            handler.sendEmptyMessage(1);
//            ((MyService) context).shang();
        }else if (intent.getAction().equals("next")){
            handler.sendEmptyMessage(2);
//            ((MyService) context).next();
        }else if(intent.getAction().equals("stop")){
            handler.sendEmptyMessage(3);
//            ((MyService) context).stop();
        }else {
            handler.sendEmptyMessage(4);
//            ((MyService) context).start();
        }
    }
}
